package com.ebelter.seneo.ui.fragments.addinfos;


import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ebelter.btcomlib.common.IOrder;
import com.ebelter.btcomlib.utils.ViewUtils;
import com.ebelter.seneo.R;
import com.ebelter.seneo.ui.activitys.SeneoAddInfoActivity;
import com.ebelter.seneo.ui.fragments.BaseFragment;


//填写密码
public class AddInfo_Athlete_Fragment extends BaseFragment{



    RelativeLayout addinfo_sex_male_rl;
    RelativeLayout addinfo_sex_female_rl;
    ImageView addinfo_sex_male_iv;
    ImageView addinfo_sex_female_iv;

    LinearLayout addinfo_athlete_ll;
    TextView addinfo_athlete_tv;

    private int roleType;//0普通人 1运动员
    @Override
    protected int setLayoutResouceId() {
        return R.layout.addinfo_sex_athlete;
    }


    @Override
    protected void initView() {
        FV();
    }

    private void FV() {
        addinfo_sex_male_rl=findViewById(R.id.addinfo_sex_male_rl);
        addinfo_sex_female_rl=findViewById(R.id.addinfo_sex_female_rl);
        addinfo_sex_male_iv=findViewById(R.id.addinfo_sex_male_iv);
        addinfo_sex_female_iv=findViewById(R.id.addinfo_sex_female_iv);
        addinfo_athlete_ll=findViewById(R.id.addinfo_athlete_ll);
        addinfo_athlete_tv=findViewById(R.id.addinfo_athlete_tv);
        selectSex(0);
        adapterUi();
    }

    private void adapterUi() {
        if (getActivity()==null)return;
        if ( ((SeneoAddInfoActivity)getActivity()).currentCMD==SeneoAddInfoActivity.CMD_register){
            //注册界面 不需要改任何界面
        }else {
            //添加用户信息界面
            ViewUtils.goneView(addinfo_athlete_tv);
            ViewUtils.setBottomMargin(addinfo_athlete_ll,90);
        }
    }

    @Override
    protected void setListener() {
        addinfo_sex_male_rl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectSex(1);
            }
        });
        addinfo_sex_female_rl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectSex(0);
            }
        });
    }



    //0普通人1运动员
    private void selectSex(int sex){
        roleType=sex;
        ViewUtils.hideView(addinfo_sex_male_iv);
        ViewUtils.hideView(addinfo_sex_female_iv);
        ViewUtils.displayView(roleType==0?addinfo_sex_female_iv:addinfo_sex_male_iv);
    }



    //0普通人 1运动员
    public int getSelectedAthlete(){
        return roleType;
    }
}
